package com.turbo.cloud.core.base;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

/**
 * @author zhangluning
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@ToString(callSuper = true)
public class PageQuery<T extends Serializable> extends Page<T> {

    /**
     * 查询参数
     */
    private T param;

    public <S> Page<S> toPage() {
        Page<S> page = new Page<>();
        BeanUtils.copyProperties(this, page);
        return page;
    }
}
